package com.bestcem.xm.qdes.util;


import com.alibaba.fastjson.JSONObject;

import java.util.*;
import java.util.regex.Pattern;

import static com.bestcem.xm.qdes.grpc.v1.services.ProjectStatus.*;

/**
 * 问卷结构的key都在这里
 */
public interface QstructConstant {

    // 字母开头，只能输入字母、数字和英文下划线
    Pattern CID_FORMAT_REGEX = Pattern.compile("^[a-zA-Z][_a-zA-Z0-9]{1,10}$");

    String D_UNDERSCORE = "__";

    String GID = "gid";

    String R_Gid = "r_gid";

    String O_Gid = "o_gid";

    String GID_LIST = "gid_list";

    String CID = "cid";

    String Q_LIST = "qList";

    String SEQ = "seq";

    String MODIFIED = "modified";

    String EXT_ID = "extID";

    String DEFAULT_Q_TIMECOST = "default_q_timecost";

    String Q_TIMECOST = "q_timecost";

    String QTYPE = "qtype";

    String CUSTOM_QTYPE = "custom_qtype";

    String ITEMS = "items";

    String OID = "oid";

    String OPTION_LIST = "option_list";

    String OTYPE = "otype";

    String T_OPTION_T = "_option_";

    String ROWS_ITEMS = "rows_items";

    String TITLE = "title";

    String INFO_LEVEL = "info_level";

    String OPTIONS_GROUP_EFFECT = "optionsGroupEffect";

    String RELATED_REFS = "relatedRefs";

    String OPTION_ORIGIN = "option_origin";

    String ATTACH_DATA = "attachData";

    String OPEN_ATTACH = "openAttach";

    String SIG = "sig";

    String DATA = "data";

    List<Integer> PROJ_EDITABLE_STATUS_LIST = Arrays.asList(PROJECT_STATUS_CREATED.getNumber(), PROJECT_STATUS_ACTIVATED.getNumber(), PROJECT_STATUS_FINISHED.getNumber());

    // qdes_qstruct data字段需要校验的key值列表
    Set<String> QS_KEYS = new HashSet<String>() {{
        add(".desc.text");
        // 这个好像没用，应该是desc_begin_page.desc.text
        add("desc_begin_page.desc.text");
        add("desc_begin_page.content.text");
        add("desc_end_page.content.text");
        add("desc_end_page.content.quota_full");
        add("desc_end_page.content.screen_out");
        add("desc_question_page_default.submit_btn.text");
        //JAVA 新增
        add("desc_question_page_default.phone_submit_btn.text");
    }};

    // qdes_question data字段需要校验的key值列表
    Set<String> Q_KEYS = new HashSet<String>() {{
        add("title");
        add("items.title");
        add("rows_items.title");
        add("rows_items.rightWord");
        add("group_list");
        add("option_list.title");
        add(".left_words");
        // 这个好像没用，应该是prompt_text.left_words
        add("prompt_text.left_words");
        add("prompt_text.middle_words");
        add("prompt_text.right_words");
    }};

    Set<String> MULTI_Q = new HashSet<String>() {{
        add("multiple_blank");
        add("score");
        add("nps");
        add("sort");
        add("matrix_blank");
        add("matrix_score");
        add("proportion");
    }};


    Set<String> MATRIX_Q = new HashSet<String>() {{
        add("matrix_single");
        add("matrix_multiple");
        add("matrix_blank");
        add("matrix_score");
    }};


    Set<String> SCORE_Q = new HashSet<String>() {{
        add("score");
        add("matrix_score");
        add("nps");
    }};

    List<JSONObject> CITY_JSON = new ArrayList<JSONObject>() {{
        add(JSONObject.parseObject("{\"seq\":\"1\",\"title\":\"省份\"}"));
        add(JSONObject.parseObject("{\"seq\":\"2\",\"title\":\"城市\"}"));
        add(JSONObject.parseObject("{\"seq\":\"3\",\"title\":\"区/县\"}"));
        add(JSONObject.parseObject("{\"seq\":\"4\",\"title\":\"街道信息\"}"));
    }};


    List<JSONObject> EVALUATION_NEW = new ArrayList<JSONObject>() {{
        add(JSONObject.parseObject("{\"seq\":\"score\",\"title\":\"分值\"}"));
        add(JSONObject.parseObject("{\"seq\":\"tagsId\",\"title\":\"标签\"}"));
        add(JSONObject.parseObject("{\"seq\":\"open\",\"title\":\"留言\"}"));
    }};

    List<JSONObject> EVALUATION_OLD = new ArrayList<JSONObject>() {{
        add(JSONObject.parseObject("{\"seq\":\"score\",\"title\":\"分值\"}"));
        add(JSONObject.parseObject("{\"seq\":\"tag\",\"title\":\"标签\"}"));
        add(JSONObject.parseObject("{\"seq\":\"open\",\"title\":\"留言\"}"));
    }};

    List<String> INDIVIDUAL_EXCEL_EXPORT_HEADERS =
        Arrays.asList("题目编号&题型", "题目/选项/矩阵行标题",	"题目/选项/矩阵行属性", "显示代码/抹灰代码", "跳转代码", "自动勾选代码");

}
